<div style="padding:30px;">
<?php
 $arrMonth  = array(1=>"Jan",2=>"Feb",3=>"Mar",4=>"Apr",5=>"May",6=>"Jun",7=>"Jul",8=>"Aug",9=>"Sep",10=>"Oct",11=>"Nov",12=>"Dec");
 ?>
<form method="post" action="" />
<b>  Year </b><select class="txt1" name="financial_year"> 
		  													<?php 
															/*if(empty($year))
															{
															$count=count($finYears);
															$year  = $finYears[$count-1]['id'];
															}*/
															foreach($finYears as $row)
															  {
																  echo "<option ";
																  if($year== $row['id'])
																  echo "selected ";
																  else if(empty($year)){ if($row['flag']==1) echo "selected"; }
																  echo " value=".$row['id'].">". $row['year1'] ." ". $arrMonth[$row['month1']]."-".$row['year2'] ." ". $arrMonth[$row['month2']]."</option>";
															  }
		                                                       ?> </select> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<b> Month </b> <?php 
 // print_r($finYears);
  $month= array('1'=>"Jan",'2'=>"Feb",'3'=>"Mar",
		               '4'=>"Apr",'5'=>"May",'6'=>"Jun ",
					   '7'=>"Jul",'8'=>"Aug",'9'=>"Sep",
					   '10'=>"Oct",'11'=>"Nov",'12'=>"Dec"
					   ); 
					   
	?>


        <?php 
		
		if(empty($mon))
		{
		$current_month= date('m');
		$mon= $current_month-1;
		if($current_month=='12')
		{
			$mon=1;
		}
		}
		//echo $previous_month;
		?>
        
         <select class="txt3" name="month"> 
        <option value="">  Select Month </option>
        <?php 
		foreach($month as $key=>$val)
		{
			echo "<option ";
			if($key==$mon)
			{
				echo "selected";
			}
			echo " value=".$key.">".$val."</option>";
		}
		 ?> </select> 
         
<input type="submit" value="go" name="search" class="btn_bt" border="0"/> 

         </form>
           
       


     <?php
	 //print_r($staff);
	// print_r($result);
	 if(!empty($result))
	 {
		 ?>
        <?php /* <form method="post" action="">
         <input type="hidden" name="financial_year"  value="<?php echo $year; ?>"/>
         <input type="hidden" name="month"  value="<?php echo $mon; ?>"/>
         <input type="hidden" name="tt"  value="hj"/>
         <input name="print" type="image" alt="submit" src="<?=$admin_image_path ?>print.jpg"  />
         
       
         </form> */ ?> <a href="<?=$admin_base_url?>/staff/pdf_salary_report/<?=$mon?>/<?=$year?>" target="_blank"> <img src="<?=$admin_image_path; ?>print.jpg" alt="" /> </a>
         <table  id="tbllist">
	<tbody>
	<tr>
		<th> <b>Name </b></th> 
        <th> <b> Code </b></th>
         <th><b> Basic  </b></th> 
         <th><b> DA Amount</b></th>
         <th> <b>  HRA Amount </b></th>
         <th> <b> Other Allowance </b></th>
         <th><b> Total </b></th>
          <th><b> Provident Fund </b></th>
         <th> <b> Life Insurance </b></th>
         <th><b> Misc Recoveries </b></th>
         <th> <b> Net Amount Paid </b></th>
         <th><b> Status </b></th>
     </tr>  

         
         
         <?php
		 foreach($result as $record)
		 {
		 ?>
         
         <tr>
         <td>  <?php echo $record['first_name']." ".$record['last_name'];  ?>
         </td>
         <td> <?php echo  $record['staff_code']; ?> </td>
		 <?php
		    if($record['paid']==0) 
			 {
				 echo "<td colspan='9'>&nbsp;<td>";
			 }
			 else{
		
			
			
		 ?>  </td> 
      
          <td> <?php echo  $record['basic_pay']; ?> </td>
       
           <td> <?php
		   if($record['da_type']=='percent')
		   $record['da_amount'] =  $record['basic_pay']*$record['da_amount']/100;
		    echo  $record['da_amount']; ?> </td>
           
            <td> <?php 
			  if($record['hra_type']=='percent')
		   $record['hra_amount'] =  $record['basic_pay']*$record['hra_amount']/100;
			echo  $record['hra_amount']; ?> </td>
             <td> <?php echo  $record['other_allowance']; ?> </td>
             <td> <?php echo  $record['total']; ?> </td>
             <td> <?php echo  $record['pf_amount']; ?> </td>
              <td> <?php echo  $record['life_insurance']; ?> </td>
              <td> <?php echo  $record['misc_recoveries']; ?> </td>
              <td> <?php echo  $record['net_amount_paid']; ?> </td>
              <td> <?php }
			   if($record['paid']==0) 
			  			{
							echo "Not paid";
			  		    }
						elseif($record['paid']==1)
						{
							echo "<img src='".$admin_image_path."/icons/apply.png'>";
						}
			        ?> 
                    
              </td>
         </tr>
         <?php
		 }
	 }
	 ?>  


</tbody>
</table>
    
    
     
    
   
 


    

		
       
         
   
   
	
			
		



 </div>
 <script type="text/javascript">//<![CDATA[
      Calendar.setup({
        inputField : "f_dob",
        trigger    : "f_dob_button",
        onSelect   : function() { this.hide() },
        showTime   : 12,
        dateFormat : "%Y-%m-%d"
      });
    //]]></script>
 <script>
 $(document).ready(function() {
     $("#staff_form").RSV({
       onCompleteHandler: frmSubmit,
       errorFieldClass: "errorDesc",
       displayType: "display-html",
       errorHTMLItemBullet: "&#8212; ",
             rules: [
                     "required,basic_pay,Please enter name.",
					 
             ]
     });
  // a custom onComplete handler to prevent form submits for the demo
     function frmSubmit()
     {
       return true;
     }

        
});
 </script>
